package com.example.controller;

import com.example.client.userserver;
import com.example.entiys.User;
import com.example.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ThreadPoolExecutor;

@RestController
@RequestMapping("/article")
@Api("文章")
public class Regioncontroller {



 /*@Autowired
 userserver userserver;
    @GetMapping("/list")
    @ApiOperation("列表")
    public Result list() {

        return Result.sucusess(userserver.LIST());
    }
    @Autowired
    ThreadPoolExecutor threadPoolExecutor;

    @GetMapping("/jk")
    public Result jk() throws InterruptedException {
        List<List<User>> list1 = new ArrayList<>();

        *//*创建等待多少个线程完成*//*
        CountDownLatch Latch = new CountDownLatch(10);
        for (int i = 0; i<10; i++)
        {

            List<User> list = userserver.LIST();
            threadPoolExecutor.execute(
                    ()->{
                    list1.add(list);
                    *//*完成一个就减一*//*
                    Latch.countDown();
            }
            );

        }
        *//*没执行完线程就等待*//*
        Latch.await();
        return Result.sucusess(list1);
    }*/
}
